import React, { Component } from "react";

export default class App extends Component {
  constructor() {
    super();
    this.state = {
      count: 32,
    };
  }
  render() {
    return (
      <div>
        <h2>当前计数{this.state.count}</h2>
        <button onClick={(e) => this.increment()}>add</button>
      </div>
    );
  }
  increment() {
    this.setState((pre, props) => {
      return {
        count: (pre.count += 1),
      };
    });
    this.setState((pre, props) => {
      return {
        count: (pre.count += 1),
      };
    });
    this.setState((pre, props) => {
      return {
        count: (pre.count += 1),
      };
    });
  }
}
